<?php

class Country extends Country_model {

    function __construct() {
        parent::__construct();
    }
    
    function getList($filter=array()) {
        $country = new Country();
        if(isset($filter['name']) && $filter['name']) {
            $country->addWhere("name like '%".$filter['name']."%'");
        }
        if(isset($filter['disabled'])) {
            $country->addWhere("disabled = '".$filter['disabled']."'");
        }
        $country->orderBy("name");
        $country->find();
        return $country;
    }
    
    function isDisableAble() {
        
        return '1';
    }

    public function isDisabled($id = 0, $value = 0) {
		$country = new Country();
		if (!$id || !$country->get($id) || !$country->isDisableAble()) {
			return '0';
		}
        
		$country->disabled = $value;
        
        $country->update();
		return '1';
	}
    
    public function insert() {
        parent::insert();
    }
    
    public function update() {
        parent::update();
    }
}
